package com.lam.system.entity;

import java.math.BigDecimal;
import java.util.Date;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Size;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.lam.common.base.domain.BaseEntity;
import com.lam.common.base.domain.tree.BaseTree;
import com.lam.common.components.dict.annotation.Dict;
import com.lam.common.components.easyexcel.converter.DictConverter;
import com.lam.common.utils.DateUtil;
import com.lam.common.validate.annotation.DictCheck;
import com.lam.common.validate.annotation.DictValid;
import com.lam.common.validate.group.Add;

/**
 * 菜单管理对象 sys_menu
 * 
 * @author admin
 * @date 2022-09-01
 */
@DictCheck
@ColumnWidth(30)
@TableName("sys_menu")
public class SysMenu extends BaseTree<SysMenu> implements BaseEntity {

    /** 主键 */
    @ExcelIgnore
    @Null(groups = Add.class, message="id必须为空")
    @TableId(type = IdType.AUTO)
    private String id;
    
    /** 父id */
    @ExcelProperty("父id")
    @NotNull(message = "父id不能为空")
    private String parentId;

    /** 菜单标题 */
    @ExcelProperty("菜单标题")
    @NotBlank(message = "菜单标题不能为空")
    @Size(max = 100, message = "菜单标题长度不能超过100个字符")
    private String name;

    /** 描述 */
    @ExcelProperty("描述")
    @NotBlank(message = "描述不能为空")
    @Size(max = 255, message = "描述长度不能超过255个字符")
    private String description;

    /** 跳转路径 */
    @ExcelProperty("跳转路径")
    @Size(max = 255, message = "跳转路径长度不能超过255个字符")
    private String path;

    /** 路径类型(0-内部路径, 1-外部链接) */
    @ExcelProperty(value = "路径类型", converter = DictConverter.class)
    @DictValid(message = "无效的路径类型")
    @Dict(dictCode = "path_type", targetField = "pathTypeText")
    private Integer pathType;
    @TableField(exist = false)
    private String pathTypeText;

    /** 组件 */
    @ExcelProperty("组件")
    @Size(max = 255, message = "组件长度不能超过255个字符")
    private String component;

    /** 菜单类型(0-一级菜单, 1-子菜单, 2-按钮) */
    @ExcelProperty(value = "菜单类型", converter = DictConverter.class)
    @DictValid(message = "无效的菜单类型")
    @Dict(dictCode = "menu_type", targetField = "menuTypeText")
    private Integer menuType;
    @TableField(exist = false)
    private String menuTypeText;

    /** 权限编码 */
    @ExcelProperty("权限编码")
    @Size(max = 255, message = "权限编码长度不能超过255个字符")
    private String perms;

    /** 排序 */
    @ExcelProperty("排序")
    private BigDecimal sortNo;

    /** 菜单图标 */
    @ExcelProperty("菜单图标")
    @Size(max = 100, message = "菜单图标长度不能超过100个字符")
    private String icon;

    /** 是否缓存该页面(0否,1是) */
    @ExcelProperty(value = "是否缓存该页面", converter = DictConverter.class)
    @DictValid(message = "无效的是否缓存值")
    @Dict(dictCode = "yn10", targetField = "keepAliveText")
    private Integer keepAlive;
    @TableField(exist = false)
    private String keepAliveText;

    /** 是否隐藏路由(0否,1是) */
    @ExcelProperty(value = "是否隐藏路由", converter = DictConverter.class)
    @DictValid(message = "无效的是否隐藏路由值")
    @Dict(dictCode = "yn10", targetField = "hiddenText")
    private Integer hidden;
    @TableField(exist = false)
    private String hiddenText;

    /** 状态(0-不可用, 1-可用) */
    @ExcelProperty(value = "状态", converter = DictConverter.class)
    @NotNull(message = "状态不能为空")
    @DictValid(message = "无效的状态")
    @Dict(dictCode = "status_type", targetField = "statusText")
    private Integer status;
    @TableField(exist = false)
    private String statusText;

    /** 创建人 */
    @ExcelProperty("创建人")
    private String createBy;

    /** 创建时间 */
    @ExcelProperty("创建时间")
    @JsonFormat(pattern = DateUtil.PATTERN_DEFAULT)
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    /** 更新人 */
    @ExcelProperty("更新人")
    private String updateBy;

    /** 更新时间 */
    @ExcelProperty("更新时间")
    @JsonFormat(pattern = DateUtil.PATTERN_DEFAULT)
    @TableField(fill = FieldFill.UPDATE)
    private Date updateTime;


    public String getLabel() {
        return name;
    }  
    
    public void setId(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    } 

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getParentId() {
        return parentId;
    }    
    
    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }    
    
    public void setDescription(String description) {
        this.description = description;
    }

    public String getDescription() {
        return description;
    }    
    
    public void setComponent(String component) {
        this.component = component;
    }

    public String getComponent() {
        return component;
    }    
    
    public void setMenuType(Integer menuType) {
        this.menuType = menuType;
    }

    public Integer getMenuType() {
        return menuType;
    }    
    
    public void setPerms(String perms) {
        this.perms = perms;
    }

    public String getPerms() {
        return perms;
    }    
    
    public void setSortNo(BigDecimal sortNo) {
        this.sortNo = sortNo;
    }

    public BigDecimal getSortNo() {
        return sortNo;
    }    
    
    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getIcon() {
        return icon;
    }    
    
    public void setKeepAlive(Integer keepAlive) {
        this.keepAlive = keepAlive;
    }

    public Integer getKeepAlive() {
        return keepAlive;
    }    
    
    public void setHidden(Integer hidden) {
        this.hidden = hidden;
    }

    public Integer getHidden() {
        return hidden;
    }    
    
    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getStatus() {
        return status;
    }    
    
    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public String getCreateBy() {
        return createBy;
    }    
    
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getCreateTime() {
        return createTime;
    }    
    
    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    public String getUpdateBy() {
        return updateBy;
    }    
    
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public Integer getPathType() {
		return pathType;
	}

	public void setPath_type(Integer pathType) {
		this.pathType = pathType;
	}

	public String getHiddenText() {
		return hiddenText;
	}

	public void setHiddenText(String hiddenText) {
		this.hiddenText = hiddenText;
	}

	public String getPathTypeText() {
		return pathTypeText;
	}

	public void setPathTypeText(String pathTypeText) {
		this.pathTypeText = pathTypeText;
	}

	public String getMenuTypeText() {
		return menuTypeText;
	}

	public void setMenuTypeText(String menuTypeText) {
		this.menuTypeText = menuTypeText;
	}

	public String getKeepAliveText() {
		return keepAliveText;
	}

	public void setKeepAliveText(String keepAliveText) {
		this.keepAliveText = keepAliveText;
	}

	public String getStatusText() {
		return statusText;
	}

	public void setStatusText(String statusText) {
		this.statusText = statusText;
	}

	public void setPathType(Integer pathType) {
		this.pathType = pathType;
	}    
    

}
